﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Sql;
using System.Data.SqlClient;
using System.IO;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;  


namespace community
{
    public partial class diseaseprint : Form
    {
        public diseaseprint( Form f)
        {
            InitializeComponent();
        }

        private void diseaseprint_Load(object sender, EventArgs e)
        {
            string strSql = "select b.diseasename_vchr,b.happendate_dat,b.happenpart_chr,b.suretime_dat,b.diagnosehospital_vchr,";
            strSql += "b.surereason_chr,b.healdate_dat,b.healeffect_vchr,b.remark_vchr,a.INHABITANTCODE_CHR,a.RESIDENTNAME_CHR,";
            strSql += "a.SEX_CHR,a.BIRTH_DAT,a.COMMUNITYNAME_CHR,a.FAMILYNAME_CHR from T_CS_INHABITANTRECORD_NEW a  left join ";
            strSql += "t_cs_membermedical b on a.INHABITANTCODE_CHR=b.INHABITANTCODE_CHR  where ";
            strSql += "a.inhabitantcode_chr='" + residentcode.rescode + "'";

            Crydisease cr = new Crydisease();
            DataSet ds = new DataSet();
            SqlConnection conn = new SqlConnection(SQL.conStr);
            conn.Open();
            SqlDataAdapter dap = new SqlDataAdapter(strSql, conn);
            try
            {

                dap.Fill(ds, "DataTable1");


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            cr.SetDataSource(ds.Tables[0]);
            this.diseaserep.ReportSource = cr;

        }
    }
}
